using System;
using UnityEngine;

public interface IMonoEvent
{
    /// <summary>
    /// combine event with the function of monobehaviour object
    /// </summary>
    /// <param name="monoEvent"></param>
    /// <param name="monoEventType"></param>
    public void UpdateMonoEvent(Action monoEvent, MonoEventType monoEventType);
}

public enum MonoEventType
{
    Awake,
    Start,
    Update,
    FixedUpdate,
    LateUpdate
}

public abstract class SingletonMonoBehaviour<T> : MonoBehaviour where T : MonoBehaviour
{
    public static T Instance { get; protected set; }

    protected void INI_Singleton()
    {
        if (Instance != null)
        {
            Destroy(gameObject);
            return;
        }
        Instance = this as T;
        DontDestroyOnLoad(this);
    }
}
